package com.hippo.core.service;

import com.alibaba.fastjson.JSONObject;
import com.hippo.core.dao.CaseConfigDao;
import com.hippo.core.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hippo
 */
@Service
public class CaseConfigService {

    @Autowired
    private CaseConfigDao caseConfigDao;

    public JSONObject getCaseConfigList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = caseConfigDao.countCaseConfig(jsonObject);
        List<JSONObject> list = caseConfigDao.getCaseConfigList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    public JSONObject addCaseConfig(JSONObject data) {
        return CommonUtil.response(caseConfigDao.addCaseConfig(data));
    }

    public JSONObject deleteCaseConfig(String id) {
        return CommonUtil.response(caseConfigDao.deleteCaseConfig(id));
    }

    public JSONObject updateCaseConfig(JSONObject data) {
        return CommonUtil.response(caseConfigDao.updateCaseConfig(data));
    }
}
